package XPStruct;

public class XProcessI {
    public String  device_type;

    public String  device_udid;
    public String  device_name;

    public String  name;            //应用名称
    public String  exen;            //进程名称
    public String  _package;		//程序包名
    public String  path_install;    //安装路径
    public String  path_sandbox;    //沙盒路径

    public long  uid;               //权限, 用户
    public long  gid;               //权限, 组

    public long  pid;                //进程PID
    public long  ppid;			     //进程PID, 父级进程

    public long     time_connect;		//连接时间
    public long     time_heartbeat;     //心跳时间, 没有使用

    public String   uniqueID;           //唯一的ID值, md5(device_udid + package)

    public long     connect_index;      //连接索引, 用于确认连接数

    public String  uri;                 //链接地址

    //获取 应用的 唯一标识 (包名 or 进程名)
    public String  Identifier() {
        if ( null != _package && !_package.isEmpty() && !_package.equals("(null)"))
            return _package;
        return (null == exen || exen.isEmpty()) ? "(null)" : exen;
    }

    //获取 应用的 名称信息
    public String XProcessNAME() {
        if (null != name && !name.isEmpty() && !name.equals("(null)"))
            return name;
        return (null == exen || exen.isEmpty()) ? "(null)" : exen;
    }

    @Override
    public String toString() {
        return String.format("远程链接 = %-25s, gid = %-4d, uid = %-4d, 包名 = %-30s, %s",
                                                     uri, gid, uid, Identifier(), name);
    }

}
